package org.entryautoproxy;

import org.springframework.aop.ThrowsAdvice;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * 抛出异常增加类
 *
 * Created by chinalin on 2017/3/18.
 */
@Component
public class GreetingThrowAdvice implements ThrowsAdvice{

    public void afterThrowing(Method method,Object[] args,Object target,Exception e){
        System.out.println("---------- Throw Exception ----------");

        System.out.println("Target Class: " + target.getClass().getName());

        System.out.println("Method Name: " + method.getName());

        System.out.println("Exception Message: " + e.getMessage());

        System.out.println("-------------------------------------");
    }
}
